package com.cy.pj.common.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = -7102073483915049133L;
    private Integer rowCount;
    private List<T> records;
    private Integer pageCount;
    private Integer pageSize;
    private Integer pageCurrent;

    public PageObject(Integer rowCount, List<T> records, Integer pageSize, Integer pageCurrent) {
        this.rowCount = rowCount;
        this.records = records;
        this.pageSize = pageSize;
        this.pageCurrent = pageCurrent;
        this.pageCount=this.rowCount/this.pageSize;
        if (this.rowCount%this.pageSize!=0)
            this.pageCurrent++;
    }
}
